/**
 * @ClassName: UserAccountDetailUtils
 * @author 831
 * @date 2016骞?10鏈?21鏃?
 */
package com.fzrskj.cloud.free.user.utils;

import com.fzrskj.cloud.free.user.bean.UserAccountDetail;
import com.fzrskj.cloud.free.user.bean.UserAccountDetailView;
import com.fzrskj.cloud.free.user.dao.UserAccountDetailDao;
import ms.core.object.CObject;

import java.util.List;
import java.util.Map;

public class UserAccountDetailUtils extends CObject{
	/**
	 * 查询当前条件的记录数
	 * @param cdt
	 * @return
	 */
	public int queryAccountDetailNum(Map<String, Object> cdt){
		UserAccountDetailDao dao=new UserAccountDetailDao();
		int ret = dao.queryUserAccountDetail(cdt);
		this.setErrCode(dao.getErrCode());
		dao.dispose();
		return ret;
	}

	/**
	 * 查询当前条件的记录列表
	 * @param cdt
	 * @param page
	 * @param pagesize
	 * @return
	 */
	public List<UserAccountDetail> queryAccountDetailList(Map<String, Object> cdt, int page, int pagesize){
		UserAccountDetailDao dao=new UserAccountDetailDao();
		List<UserAccountDetail> ret = dao.queryUserAccountdetailList(cdt, page, pagesize);
		this.setErrCode(dao.getErrCode());
		dao.dispose();
		return ret;
	}

	/**
	 * 查询当前条件的记录列表
	 * @param cdt
	 * @param page
	 * @param pagesize
	 * @return
	 */
	public List<UserAccountDetailView> queryAccountDetailViewList(Map<String, Object> cdt, int page, int pagesize){
		UserAccountDetailDao dao=new UserAccountDetailDao();
		List<UserAccountDetailView> ret = dao.queryUserAccountdetailViewList(cdt, page, pagesize);
		this.setErrCode(dao.getErrCode());
		dao.dispose();
		return ret;
	}

	/**
	 * 添加入款扣款数据记录
	 * @param obj
	 * @return
	 */
	public int addUserAccountDetail(UserAccountDetail obj){
		UserAccountDetailDao dao = new UserAccountDetailDao();
		int i=dao.addUserAccountdetail(obj);
		this.setErrCode(dao.getErrCode());
		dao.dispose();
		return i;
	}

	public double queryAccountDetailAmount(Map<String, Object> cdt) {
		UserAccountDetailDao dao =  new UserAccountDetailDao();
		double amount = dao.queryAccountDetailAmount(cdt);
		String code = dao.getErrCode();
		this.setErrCode(code);
		dao.dispose();
		return amount;
	}

	//收入统计(真实入款-业务退款)
	public double queryAccountIncome(Map<String, Object> cdt) {
		UserAccountDetailDao dao =  new UserAccountDetailDao();
		double amount = dao.queryAccountIncome(cdt);
		String code = dao.getErrCode();
		this.setErrCode(code);
		dao.dispose();
		return amount;
	}

	/**
	 * 根据用户名获得可开票金额
	 * @param uname
	 * @return
	 */
	public double getAllSureInvoice(String uname) {
		UserAccountDetailDao dao=new UserAccountDetailDao();
		double total=dao.getAllSureInvoice(uname);
		String code = dao.getErrCode();
		this.setErrCode(code);
		dao.dispose();
		return total;
	}

	/**
	 * 获取财务记账详情
	 * @param cdt
	 * @return
	 */
	public UserAccountDetailView queryUadView(Map<String, Object> cdt){
		UserAccountDetailDao dao = new UserAccountDetailDao();
		UserAccountDetailView uad = dao.queryUadView(cdt);
		String code = dao.getErrCode();
		this.setErrCode(code);
		dao.dispose();
		return uad;
	}
}